package com.kpmg.questionnaire.model;

import org.springframework.core.io.FileSystemResource;

import javax.persistence.*;
import java.util.Map;

/**
 * Created by xionghao on 2016/11/12.
 */
@Entity
@Table(name = "email", schema = "questionnaire", catalog = "")
public class EmailEntity {
    private String emailHost;
    private String emailFrom;
    private String emailUserName;
    private String emailPassword;
    private String toEmails;
    private String subject;
    private String content;
    private String pictures;
    private String attachments;
    private String fromAddress;
    private String toAddresses;
    private String attachFileNames;
    private int id;

    @Basic
    @Column(name = "emailHost", nullable = true, length = 100)
    public String getEmailHost() {
        return emailHost;
    }

    public void setEmailHost(String emailHost) {
        this.emailHost = emailHost;
    }

    @Basic
    @Column(name = "emailFrom", nullable = true, length = 100)
    public String getEmailFrom() {
        return emailFrom;
    }

    public void setEmailFrom(String emailFrom) {
        this.emailFrom = emailFrom;
    }

    @Basic
    @Column(name = "emailUserName", nullable = true, length = 100)
    public String getEmailUserName() {
        return emailUserName;
    }

    public void setEmailUserName(String emailUserName) {
        this.emailUserName = emailUserName;
    }

    @Basic
    @Column(name = "emailPassword", nullable = true, length = 100)
    public String getEmailPassword() {
        return emailPassword;
    }

    public void setEmailPassword(String emailPassword) {
        this.emailPassword = emailPassword;
    }

    @Basic
    @Column(name = "toEmails", nullable = true, length = 100)
    public String getToEmails() {
        return toEmails;
    }

    public void setToEmails(String toEmails) {
        this.toEmails = toEmails;
    }

    @Basic
    @Column(name = "subject", nullable = true, length = 100)
    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    @Basic
    @Column(name = "content", nullable = true, length = 255)
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Basic
    @Column(name = "pictures", nullable = true, length = 255)
    public String getPictures() {
        return pictures;
    }

    public void setPictures(String pictures) {
        this.pictures = pictures;
    }

    @Basic
    @Column(name = "attachments", nullable = true, length = 255)
    public String getAttachments() {
        return attachments;
    }


    public void setAttachments(String attachments) {
        this.attachments = attachments;
    }

    @Basic
    @Column(name = "fromAddress", nullable = true, length = 255)
    public String getFromAddress() {
        return fromAddress;
    }

    public void setFromAddress(String fromAddress) {
        this.fromAddress = fromAddress;
    }

    @Basic
    @Column(name = "toAddresses", nullable = true, length = 255)
    public String getToAddresses() {
        return toAddresses;
    }

    public void setToAddresses(String toAddresses) {
        this.toAddresses = toAddresses;
    }

    @Basic
    @Column(name = "attachFileNames", nullable = true, length = 255)
    public String getAttachFileNames() {
        return attachFileNames;
    }

    public void setAttachFileNames(String attachFileNames) {
        this.attachFileNames = attachFileNames;
    }

    @Id
    @Column(name = "id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        EmailEntity that = (EmailEntity) o;

        if (id != that.id) return false;
        if (emailHost != null ? !emailHost.equals(that.emailHost) : that.emailHost != null) return false;
        if (emailFrom != null ? !emailFrom.equals(that.emailFrom) : that.emailFrom != null) return false;
        if (emailUserName != null ? !emailUserName.equals(that.emailUserName) : that.emailUserName != null)
            return false;
        if (emailPassword != null ? !emailPassword.equals(that.emailPassword) : that.emailPassword != null)
            return false;
        if (toEmails != null ? !toEmails.equals(that.toEmails) : that.toEmails != null) return false;
        if (subject != null ? !subject.equals(that.subject) : that.subject != null) return false;
        if (content != null ? !content.equals(that.content) : that.content != null) return false;
        if (pictures != null ? !pictures.equals(that.pictures) : that.pictures != null) return false;
        if (attachments != null ? !attachments.equals(that.attachments) : that.attachments != null) return false;
        if (fromAddress != null ? !fromAddress.equals(that.fromAddress) : that.fromAddress != null) return false;
        if (toAddresses != null ? !toAddresses.equals(that.toAddresses) : that.toAddresses != null) return false;
        if (attachFileNames != null ? !attachFileNames.equals(that.attachFileNames) : that.attachFileNames != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = emailHost != null ? emailHost.hashCode() : 0;
        result = 31 * result + (emailFrom != null ? emailFrom.hashCode() : 0);
        result = 31 * result + (emailUserName != null ? emailUserName.hashCode() : 0);
        result = 31 * result + (emailPassword != null ? emailPassword.hashCode() : 0);
        result = 31 * result + (toEmails != null ? toEmails.hashCode() : 0);
        result = 31 * result + (subject != null ? subject.hashCode() : 0);
        result = 31 * result + (content != null ? content.hashCode() : 0);
        result = 31 * result + (pictures != null ? pictures.hashCode() : 0);
        result = 31 * result + (attachments != null ? attachments.hashCode() : 0);
        result = 31 * result + (fromAddress != null ? fromAddress.hashCode() : 0);
        result = 31 * result + (toAddresses != null ? toAddresses.hashCode() : 0);
        result = 31 * result + (attachFileNames != null ? attachFileNames.hashCode() : 0);
        result = 31 * result + id;
        return result;
    }


}
